<template>
  <el-menu
    default-active="1"
    class="el-menu-vertical-demo"
    background-color="#001529"
    text-color="#A0A7AF"
    active-text-color="#E0F0FF"
    @open="handleOpen"
    @close="handleClose">
    <el-menu-item index="1" @click="handleClick('/data-overview')">
      <i class="el-icon-menu"></i>
      <span slot="title">数据概览</span>
    </el-menu-item>
    <el-submenu index="2">
      <template slot="title">
        <i class="el-icon-location"></i>
        <span>用户行为分析</span>
      </template>
      <el-menu-item-group>
        <el-menu-item index="2-1" @click="handleClick('/behavior-analysis/event')">事件分析</el-menu-item>
        <el-menu-item index="2-2" @click="handleClick('/behavior-analysis/funnel')">漏斗分析</el-menu-item>
        <el-menu-item index="2-3" @click="handleClick('/behavior-analysis/retain')">留存分析</el-menu-item>
        <el-menu-item index="2-4" @click="handleClick('/behavior-analysis/user-route')">用户路径</el-menu-item>
      </el-menu-item-group>
    </el-submenu>
  </el-menu>
</template>

<script>
export default {
  data () {
    return {
      item1: {path: '/data-overview'}
    }
  },
  methods: {
    handleOpen (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClose (key, keyPath) {
      console.log(key, keyPath)
    },
    handleClick (path) {
      this.$router.push(path)
    }
  }
}
</script>

<style lang="less">
.el-menu {
  width: 200px !important;
  .el-menu-item {
    &.is-active {
      background-color: #1890FF !important;
    }
  }
  .el-menu-item-group {
    background-color: #000C17;
    &>ul {
      .el-menu-item {
        background-color: #000C17 !important;
        &.is-active {
          background-color: #1890FF !important;
        }
      }
    }
  }
  .el-menu-item-group__title {
    padding: 0 !important;
  }
}
</style>
